setwd("~/Dropbox/Perception_Inequality_wHannah/Survey Files/Harris 1976 Labor Union Survey, study no. 7688")
library(dplyr)
library(tidyr)
library(car)
library(readstata13)
survey <- read.dta13("harris_s7688_spss.dta")
# pid
survey$pid <- c(1:nrow(survey))
# study
survey$study <- 7688
# study year (year)
survey$year <- 1976
# geographic data (urban)
survey$urban <- car::recode(survey$S13, "'Central City' = 'Urban'; 'Town' = 'Rural';
'Suburb' = 'Suburban'; 'Rural' = 'Rural'")
# geographic data (region)
survey$region <- survey$S11
levels(survey$region) <- list(East=c("East_(1)", "East_(2)"), Midwest=c("Midwest_(5)", "Midwest_(6)"),
South=c("South_(3)", "South_(4)"),
West=c("West_(7)", "West_(8)"))
class(survey$region)
# respondent head of household (hh)
survey$hh <- car::recode(survey$F1, "c('Male head', 'Female head (no male head)') = 'Yes';
c('Wife', 'Son', 'Daughter', 'Other (specify)') = 'No'; else = NA")
# increasing inequality (inequality)
survey$inequality <- car::recode(survey$P10_2, "'Don t Feel' = 'Don t feel'; 'Not Sure' = 'Not sure'")
# inequality variable (inequality.variable)
survey$inequality.variable <- 1
# union (union.self)
survey$union.self <- as.character(survey$F6_1)
survey$union.self[survey$F6_4 == "Yes"] <- "Not Sure"
survey$union.self <- factor(survey$union.self)
survey$union.other <- as.character(survey$F6_2)
survey$union.other[survey$F6_4 == "Yes"] <- "Not Sure"
survey$union.other <- factor(survey$union.other)
# employment (employed)
survey$employed <- survey$F2A
# occupation
survey$occupation <- survey$F2B
# household size (hhsize)
survey$hhsize <- NA
# education (educ)
survey$educ <- as.numeric(survey$F5)
survey$educ <- car::recode(survey$educ, "c(1, 2, 3, 4) = 'Less than high school';
5 = 'High school graduate';
c(6, 7) = 'Some college';
8 = 'College graduate';
9 = 'Post graduate';
else = 'NA'")
survey$educ <- factor(survey$educ, levels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
labels = c("Less than high school", "High school graduate", "Some college", "College graduate", "Post graduate"),
ordered = TRUE)
# household income (income)
survey$income <- survey$F7
# age
survey$age <- survey$F4
# race
survey$race <- survey$F10
# politics (party)
survey$party <- survey$P6B
# politics (ideology)
survey$ideology <- survey$P7A
# gender
survey$gender <- survey$F11
# religion
survey$religion <- survey$F8A
# subset
survey_7688 <- survey[,c("pid", "study", "year", "urban", "region", "hh",
"inequality", "inequality.variable", "union.self", "union.other",
"employed", "occupation", "hhsize", "educ", "income",
"age", "race", "party", "ideology", "gender", "religion")]
summary(survey_7688)
saveRDS(survey_7688, file = "survey_7688.rds")
